<%@ page language="java" pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@ taglib prefix="ww" uri="webwork" %>
<%@ taglib prefix="WW" uri="webwork" %>
<ww:bean name="'com.css.apps.base.dict.service.DictMan'" id="dictID" />
<ww:bean name="'com.css.apps.base.user.service.UserService'" id="userService" />
<form style="min-height:540px;" class="form-horizontal table-form"  name="user_form" id="user_form" action="dirUserMini.action"  onsubmit="return $action.query(this)">
	
	<input type="hidden" name="orgId" id="orgId" value="<ww:property value='orgId'/>">
	<input type="hidden" name="page.orderFlag" class="order-flag" value="<ww:property value='page.orderFlag'/>">
	<input type="hidden" name="page.orderString" class="order-string" value="<ww:property value='page.orderString'/>">
	<input type="hidden" name="page.pageSize" class="page-size" value="<ww:property value='page.pageSize'/>">
	<input type="hidden" name="page.totalPages" class="page-count" value="<ww:property value='page.totalPages'/>">
	<input type="hidden" name="page.currentPage" class="page-current" value="<ww:property value='page.currentPage'/>">

	<div class="table-header">
		<div class="table-search">
			<ul>
				<li>姓名：<input type="text"id="username" name="username"class="input-large" maxlength="20" placeholder="请输入姓名" value="<ww:property value='username'/>"></li>
				<li>状态：<ww:select attributes="class='input-medium'" name="'openFlag'" id="openFlag" value="openFlag"  list="#dictID.getDictListQuery('d_security_Flag')" listKey="code" listValue="name"></ww:select> </li>
				<%--<li>激活状态：<ww:select attributes="class='input-small'" name="'activeStatus'" id="activeStatus" value="activeStatus"  list="#dictID.getDictListQuery('d_active_status')" listKey="code" listValue="name"></ww:select> </li>--%>
				<li><ww:button css="btn green" caption="查询" funcode="acl_user/dirUserMini" type="submit"></ww:button></li>
			</ul>
		</div>
		<div class="table-btn">
			<div class="btn-group">
				<ww:link css="btn" caption="<i class='fa fa-plus' aria-hidden='true'></i>&nbsp;&nbsp;添加" title="添加用户" target="cssTab" rel="adduser" href="getUser.action?orgIds=%{orgId}"></ww:link>
			</div>
			<div class="btn-group">
				<ww:link css="btn" caption="<i class='fa fa-trash-o' aria-hidden='true'></i>&nbsp;&nbsp;批量删除" title="批量删除" onclick="$action.execBatch(this,{url:'delUser.action',title:'您确认彻底删除勾选的用户信息吗?'});"></ww:link>
			</div>
			<div class="btn-group">
				<ww:link css="btn" caption="<i class='fa fa-download' aria-hidden='true'></i>&nbsp;&nbsp;下载任免审批表(模板)" title="下载任免审批表(模板)" href="downloadUserTemplate.action" style="display:inline-block;"></ww:link>
			</div>
			<div class="btn-group">
				<ww:link css="btn" caption="<i class='fa fa-cloud-download' aria-hidden='true'></i>&nbsp;&nbsp;导入任免审批表" title="导入任免审批表" attributes="id='import_btn'"></ww:link>
			</div>
			<div class="btn-group">
				<ww:link css="btn" caption="<i class='fa fa-cloud-upload' aria-hidden='true'></i>&nbsp;&nbsp;导出任免审批表" title="导出任免审批表" onclick="$action.downloadBatch(this,{url:'exportUser.action',title:'您确认导出勾选的用户信息吗?'});"></ww:link>
			</div>
			<div class="btn-group">
				<ww:link css="btn" caption="<i class='fa fa-cloud-upload' aria-hidden='true'></i>&nbsp;&nbsp;导出花名册" title="导出花名册" onclick="$action.exportBatch(this,{url:'exportRoster.action',title:'您确认导出所查询用户的花名册吗?'});"></ww:link>
			</div>
			<%--<div class="btn-group">
				<ww:link css="btn" caption="初始化任免审批表(临时)" onclick="$action.exec(this,{url:'initUser.action',title:'您确认初始化全部用户信息吗?'});"></ww:link>
			</div>--%>
			<div class="btn-group btnTab" style="float:right;">
				<input type="hidden" name="includeFlag" id="includeFlag" value="<ww:property value='includeFlag'/>">
				<a class="btn" value="1" href="javascript:;">当前组织</a>
				<a class="btn" value="2" href="javascript:;">包含下级</a>
			</div>
		</div>
	</div>
	<table class="table table-bordered">
		<thead>
		<tr>
			<th width="25px"><input group="ids" class="cleck-all" type="checkbox"/></th>
			<th style="width: 150px;">操作</th>
			<th style="width: 120px;" order-field="realName" class="order">姓名</th>
			<th style="width: 80px;" order-field="sex" class="order">性别</th>
			<th>所属机构</th>
			<th style="width: 80px;" order-field="openFlag" class="order">状态</th>
			<th style="width: 50px;" order-field="orderNum" class="order">排序号</th>
		</tr>
		</thead>
		<tbody>
		<ww:iterator value="page.results" id="data" status="index">
			<tr ondblclick="javascript:$('#showLogData<ww:property value="#index.getIndex()"/>2').click();">
				<td class="text-center"><input type="checkbox"  name="ids" id="ids" value="<ww:property value="uuid" />"/></td>
				<td class="text-center">
					<%--<ww:link rel="viewUser%{uuid}" caption="查看" target="cssTab" href="getUser.action?uuid=%{uuid}&orgIds=%{orgId}&viewMod=readonly"
							 style="display:inline-block;" title="查看人员信息"></ww:link>--%>
					<ww:link rel="updUser%{uuid}" caption="修改" target="cssTab" href="getUser.action?uuid=%{uuid}&orgIds=%{orgId}"
							 style="display:inline-block;" title="人员信息"></ww:link>
					<ww:link caption="删除" onclick="$action.exec(this,{url:'delUser.action?ids=%{uuid}',title:'您确定删除该用户的全部信息吗?'})"
							 style="display:inline-block;" href="javascript:;"></ww:link>
					<%--<ww:link rel="sortUser%{uuid}" caption="排序" target="cssDialog" href="getUserOrder.action?userId=%{uuid}"
							 style="display:inline-block;" title="排序"></ww:link>--%>
					<ww:link  caption="导出" href="exportUser.action?ids=%{uuid}" style="display:inline-block;"></ww:link>
					<%--<ww:link funcode="acl_user/dirUserDev" caption="设备管理" target="cssTab" rel="dirUserDev%{uuid}"  href="dirUserDev.action?userId=%{uuid}" title="%{realName}-设备"></ww:link>--%>
				</td>
				<td class="text-center"><ww:property value="realName"/></td>
				<td class="text-center"><ww:property value="#dictID.getDictType('d_sex',sex).name" /></td>
				<td class="text-center" onclick="showUserOrgPos('<ww:property value='orgId' />')"><ww:property value="orgName" /></td>
				<td class="text-center"><ww:property value="#dictID.getDictType('d_security_Flag',openFlag).name" /></td>
				<td class="text-center">
					<a href="getUserOrder.action?userId=<ww:property value='uuid'/>&deptId=<ww:property value='orgId'/>" style="display:inline-block;width:100%;background: #e5e9ec;" title="排序设置 - <ww:property value="realName"/>" target="cssDialog">
						<ww:if test="orderNum!=null && orderNum!=''">
							<ww:property value="#userService.toSimpleNum(orderNum)" />
						</ww:if><ww:else>
							______
						</ww:else>
					</a>
				</td>
			</tr>
		</ww:iterator>
		</tbody>
	</table>
	<div class="pagination"> <ww:property value="page.pageSplit"/></div>
</form>
<script>
    $(function () {
        var button  = $('#import_btn',$.cssTab.focus());
        new AjaxUpload(button, {
            action : "importUser.action",
            name : 'file',
            data : {
                orgId : '<ww:property value="orgId" />'
            },
            autoSubmit : true,
            responseType : 'json',
            onSubmit : function(filename, ext) {
                $css.tip('数据导入中请勿进行其他操作，导入成功后页面会有相关提示！');
            },
            onComplete : function(filename, data) {
                debugger;
                if(data.result == 0){
                    $css.tip('导入成功！');
                    $(".curSelectedNode",$.cssTab.focus()).click();
                }else{
                    $css.alert(data.msg);
                }
            }
        });
	})

</script>